#include <bits/stdc++.h>
using namespace std;
const int MAXN = 200200;
int n;
int arr[MAXN];
int solve(int i, long long h, int s2, int s3) {
if (i == n) return 0;
if (arr[i] < h)
return solve(i + 1, h + (arr[i] / 2), s2, s3) + 1;
int ans1 = (s2 ? solve(i, h * 2, s2 - 1, s3) : 0);
int ans2 = (s3 ? solve(i, h * 3, s2, s3 - 1) : 0);
return max(ans1, ans2);
}
int main() {
int t; cin >> t;
while(t--) {
long long h; cin >> n >> h;
for (int i = 0; i < n; ++i)
cin >> arr[i];
sort(arr, arr + n);
cout << solve(0, h, 2, 1) << endl;
}
}
961A - Tetris | 1635B - Avoid Local Maximums |
20A - BerOS file system | 1637A - Sorting Parts |
509A - Maximum in Table | 1647C - Madoka and Childish Pranks |
689B - Mike and Shortcuts | 379B - New Year Present |
1498A - GCD Sum | 1277C - As Simple as One and Two |
1301A - Three Strings | 460A - Vasya and Socks |
1624C - Division by Two and Permutation | 1288A - Deadline |
1617A - Forbidden Subsequence | 914A - Perfect Squares |
873D - Merge Sort | 1251A - Broken Keyboard |
463B - Caisa and Pylons | 584A - Olesya and Rodion |
799A - Carrot Cakes | 1569B - Chess Tournament |
1047B - Cover Points | 1381B - Unmerge |
1256A - Payment Without Change | 908B - New Year and Buggy Bot |
979A - Pizza Pizza Pizza | 731A - Night at the Museum |
742A - Arpa’s hard exam and Mehrdad’s naive cheat | 1492A - Three swimmers |